package com.yulongtian.offers.day202208.day20220826;

/**
 * https://leetcode.cn/problems/que-shi-de-shu-zi-lcof/
 *
 * @author YulongTian
 * @date 2022/8/26 - 9:28
 */
public class Test03 {
    public static void main(String[] args) {

    }

    public int missingNumber(int[] nums) {
        int len = nums.length;
        if (len == 0) {
            return 0;
        }
        if (len == 1 && nums[0] == 0) {
            return 1;
        }
        for (int i = 0; i < len; i++) {
            if (nums[i] != i) {
                return i;
            }
            if(i==len-1){
                return len;
            }
        }
        return 0;
    }

}
